<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>云收藏手机APP</title>
    <script src="https://unpkg.com/vue@2.7.14/dist/vue.min.js"></script>
    <script src="https://unpkg.com/axios/dist/axios.min.js"></script>
    <link rel="stylesheet" href="https://unpkg.com/element-ui/lib/theme-chalk/index.css"></script>
    <script src="https://unpkg.com/element-ui/lib/index.js"></script>
    <script src="login/js/login.js"></script>
</head>
<body>
    <div id="app">
        <login @logined="onlogin" ref="lg">

        </login>
        <h1 v-if="ok">
            现在可以去扫码登录了!
        </h1>
    </div>
    <script>
        var v = new Vue({
            el : "#app",
            data : {
                ok:false
            },
            methods:{
                onlogin(user){
                    console.info(user);
                    if(user){
                        localStorage.setItem("username",user.name);
                        localStorage.setItem("password",user.pwd);
                        this.ok = true;
                    } else if(localStorage.getItem("username")){
                        this.$refs.lg.form.username = localStorage.getItem("username");
                        this.$refs.lg.form.password = localStorage.getItem("password");
                        this.$refs.lg.login();
                    }
                }
            },
        })
    </script>
</body>
<style>
    *{
        font-size: 2rem;
    }
</style>
</html>